/* 
 * File:   GUI.h
 * Created on 17. Juni 2011, 09:14
 */

#ifndef GUI_H
#include "windows.h"
#include <commctrl.h>
#include <commdlg.h>
#include <stdio.h>
#include "Player.h"
#include "Playlist.h"
#include "winuser.h"
#include "Util.h"
#include "PlaylistImExport.h"
#include <cstdlib>
#define	GUI_H

class GUI {
public:
    GUI();

    enum ELEMENT_ID {
        ID_LABEL = 1, ID_PLAY, ID_STOP, ID_PAUSE, ID_PREV, ID_NEXT, 
        ID_ADD, ID_DELETE, ID_PLAYPOSITION, ID_VOLUME, ID_LIST, ID_TIMER
    };

    void createWindow(HINSTANCE hInstance);
    void createTrackbar(HWND hwndDlg, int x, int y, int width, int height);
    void createVolumeSlider(HWND hwnd, int x, int y, int width, int height);
    void createLabel(HWND hwnd, int x, int y, int width, int height);
    void createButton(const char* btnText, HWND hwnd, int x, int y, int width, int height, const ELEMENT_ID& id);
    void createListbox(HWND hwnd);
    LRESULT CALLBACK windowEventhandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);  
    const char* getAppName();
    HWND getMainWindow();
    void addToListLast(HWND hwnd, char*);
    void updateElements();
    void openFile(HWND hwnd);
    void loadDefaultPlaylist();
    void play(HWND hwnd);
    void pause(HWND hwnd);
    void stop(HWND hwnd);
    void switchToNext(HWND hwnd);
    void switchToPrevious(HWND hwnd);
private:
    HWND mainWindow, label, listbox, file, slider, volume;
    HINSTANCE g_hInst;
    OPENFILENAME openFileName;
    HANDLE hf;
    PAINTSTRUCT ps;
    HDC hdc;
    LRESULT position;
    const char* appName;
    char szFile[260];
    float loudness;
    Player player;
    Playlist playlist;
    PlayListImExport imExport;
};

#endif	/* GUI_H */

